<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS_demo</title>
</head>
<body onload="checkTime()" onunload="displayDate()">
<script src="first_demo.js"></script>
<!--<div id="clock"></div>-->
<p>输入数据</p>
<input type="text" id="test">
<input type="button" onclick="CheckNum()" value="检查是否是数字">
<br/>
<img src="pic_bulbon.gif" id="light" onclick="changeStatus()"/><br/>
<p id="notes">点击可关灯</p>
<input type="button" onclick="myFunc()" value="测试函数"/>
<h1 id="head"></h1>
<p id="demo"></p>
<div id="div_demo"></div>

<button onclick="getElementById('demo').innerHTML=Date()">现在的时间是?</button>
<p id="demo"></p>


<form name="form_demo" action="demo-form.php" onsubmit="return validForm();" method="post" >
    请输入姓名：<input type="text" name="name" >
    邮箱：<input type="text" name="email">
    <!--<input type="text" id="num" required="required">-->
    <!--<input type="submit" onclick="IfValid2Commit()" value="测试是否是数字">-->
    <input type="submit" value="提交">
</form>

<!--<form name="myForm" action="demo-form.php" onsubmit="return validForm();" method="post">-->
    <!--Email: <input type="text" name="email">-->
    <!--<input type="submit" value="提交">-->
<!--</form>-->

<input id="id1" type="text"  onfocus="onFocus(this)" onchange="toUpper(this)" min="0" max="10" step="3" required>
<button onmouseover="mOver(this)" onmouseout="mOut(this)" onclick="checkMyNum()" onmousedown="mDown(this)"  onmouseup="mUp(this)">验证数字</button>
<p id="num_demo"></p>
<a href="#test">点击回到顶端</a>
<script>
    function person(firstname,lastname,age){
        this.firstname=firstname;
        this.lastname=lastname;
        this.age=age;
        //this.eyecolor=eyecolor;
        this.changeName=changeName;
        function changeName(name){
            this.lastname=name;
        }
//        this.info=display;
//        function display()
//        {
//            document.write(this.eyecolor);
//        }
    }
    myMother=new person("Sally","Rally",48);
    myMother.eyecolor="blue"
    myMother.changeName("Doe");
    document.write(myMother.lastname);
   // myMother.info();

    var txt="";
    for(x in myMother)
    {
       if(x.propertyIsEnumerable==false)
           continue;
        txt+=myMother[x];
    }
    document.write(txt);
</script>

<script>
////测试string的方法
//var str="helworld!worldome to JavaScript's world."
//var n=str.indexOf(" ");
//document.writeln("<br/>第一个空格位置是："+n);
//var last=str.lastIndexOf("s");
//document.writeln("<br/>最后一个s位置是："+last+",总长度是："+str.length);
//document.writeln("<br/>str.match(\"world\"):"+str.match(/world/g));
//document.writeln("<br/>替代world为toy"+str.replace(/world/g,"toy"));

//var str_another=str_another.replace(":","");

function patt_test()
{
    var str_another="1,fdsfsdfsef,:hhhhhhhhh\n";
    var patt=/[,:]+/;
    patt.compile(patt);
    var p=str_another.split(patt);
//    for(var i=0;i<p.length;i++)
//        document.writeln("<br/>split"+p[i]);
    //document.writeln("finish");
}
var time=new Date();
var str=time.getMilliseconds().toString()+"----------";
for(var k=0;k<100000;k++)
{
    patt_test();
}
time=new Date();
str+=time.getMilliseconds().toString();
document.writeln(str);

//alert("warning:\n click to continue!")
//var con=confirm("are yo sure to continue?");
//if(con)
//    document.write("true");
//else
//    document.write("false");

document.write("<br/>"+prompt("输入项目名","project_name"));

//测试Date的方法
//var today=new Date();
//document.writeln("<br/>"+today.toDateString()+"<br/>"+today.toString()+"<br/>"+today.toJSON()+"<br/>"+today.toTimeString())
//测试数组的方法
//var arr=[1,2,3,4];
//function multiply(num,index,array)
//{
//    return num*100+index*10+array.length;
//}
//document.write("<br/>"+arr.map(multiply));
</script>
<p id="pat_test"></p>
<p id="clock" ></p>


</body>
</html>